import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2022-11-04
 * Time: 19:30
 */
class Student{
    String name;
    Student( String name){
        this.name =name;
    }

}
public class Test {
    public static void main(String[] args) {
        int[] tmp = new int[5];
        List<Student> list = new ArrayList<Student>();
        list.add(null);
        Scanner scan = new Scanner(System.in);
        for (int i = 1; i <=5; i++) {
            list.add(new Student(scan.nextLine()));
        }
        System.out.println("从中选三个人");
       for (int i = 1; i <= 3;i++){
          int k =new Random().nextInt(5)+1;
          System.out.print(list.get(k).name+" ");
          tmp[i] = k;
       }
      System.out.println("再从三人中选一个");
       int a = new Random().nextInt(3)+1;
        System.out.println(list.get(tmp[a]).name);
    }
}
